package com.heima.article.controller.v1;

import com.heima.article.service.ApArticleBehaviorService;
import com.heima.model.behavior.dtos.BehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
@RequiredArgsConstructor
public class ArticleBehaviorController {

    private final ApArticleBehaviorService apArticleBehaviorService;

    /**
     * 文章收藏
     * @param dto
     * @return
     */
    @PostMapping("/collection_behavior")
    public ResponseResult collection(@RequestBody BehaviorDto dto) {
        return apArticleBehaviorService.collection(dto);
    }

    /**
     * 数据回显
     * @param dto
     * @return
     */
    @PostMapping("/load_article_behavior")
    public ResponseResult loadData(@RequestBody BehaviorDto dto) {
        return apArticleBehaviorService.loadData(dto);
    }
}
